package com.qmhl.toolposition.bean

import com.qmhl.toolposition.R
import com.qmhl.toolposition.api.content.BannerResponse

class DataBean {
    var imageUrl: String? = null
    var skipUrl: String? = null
    var title: String?
    var isSkip: Int? = null

    constructor(url: String?, skipUrl: String?, title: String?, isSkip: Int) {
        this.imageUrl = url
        this.skipUrl = skipUrl
        this.title = title
        this.isSkip = isSkip
    }


    companion object {


        fun convertBannerList(bannerResponse: BannerResponse): List<DataBean> {
            val list: MutableList<DataBean> = ArrayList()

            var dataList = bannerResponse.data
            dataList.forEach {
                var bannerTitle = it.bannerTitle
                var url = it.bannerUrl
                var isSkip = it.isSkip
                var skipUrl = it.skipUrl

                list.add(DataBean(url, skipUrl,  bannerTitle, isSkip))
            }

            return list
        }


        //测试数据，如果图片链接失效请更换
        val testData3: List<DataBean>
            get() {
                val list: MutableList<DataBean> = ArrayList()
//                list.add(
//                    DataBean(
//                        "https://img.zcool.cn/community/013de756fb63036ac7257948747896.jpg",
//                        null,
//                        R.mipmap.banner_two
//                    )
//                )
//                list.add(
//                    DataBean(
//                        "https://img.zcool.cn/community/01639a56fb62ff6ac725794891960d.jpg",
//                        null,
//                        R.mipmap.banner_two
//                    )
//                )
//                list.add(
//                    DataBean(
//                        "https://img.zcool.cn/community/01270156fb62fd6ac72579485aa893.jpg",
//                        null,
//                        R.mipmap.banner_two
//                    )
//                )
                return list
            }
    }
}